package cos.android.sprites;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;

public class Obstacle extends Element {

	//It colliding surface
	private Rect surface;
	//The damage (in points of life) the character receives when colliding
	private int letality;
	
	public Obstacle(Bitmap sprite, int xPos, int yPos, int height, int width) {
		super(sprite, xPos, yPos, height, width);

		Rect rect = getRect();
		rect.top = 0;
		rect.bottom = getHeight();
		rect.left = 0;
		rect.right = getWidth();
		setRect(rect);
		letality = 30;

		
	}

	@Override
	public void draw(Canvas canvas) {
		Rect dest = new Rect(Math.round(getxPos()), Math.round(getyPos()),
				Math.round(getxPos() + getWidth()), Math.round(getyPos()
						+ getHeight()));
		surface = dest;
		
		canvas.drawBitmap(getSprite(), getRect(), dest, null);
	}

	public Rect getSurface()
	{
		return surface;
	}
	
	public int getLetality()
	{
		return letality;
	}
}
